﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Windows;

namespace KgUtils.Wpf.Converters
{
    /// <summary>
    /// Fait un && sur toutes les valeurs booléennes en entrée
    /// </summary>
    public class MultipleAndBooleanConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            bool total = true;
            foreach (var val in values)
            {
                if (val != DependencyProperty.UnsetValue)
                    total &= (bool)val;
            }

            return total;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
